package com.hue.rabbitmq;

import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;
import java.util.Date;

@Component
@RabbitListener(queues = "hello")   //监听的消息队列
public class MsgReceiver {

    @RabbitHandler  //监听到消息后处理的方法
    public void receiverHello(String hello){
        System.out.println(new Date().toString()+"消费者接收到一个消息:"+hello);
    }

}
